package com.aiit.mapper;

import com.aiit.annotation.AutoFill;
import com.aiit.dto.EmployeePageQueryDTO;
import com.aiit.entity.Tea;
import com.aiit.entity.TeaCup;
import com.aiit.enumeration.OperationType;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TeaCupMapper {
    /**
     * 根据用户名查询员工
     *
     * @param username
     * @return
     */
    @Select("select * from employee where username = #{username}")
    Tea getByUsername(String username);

    Page<TeaCup> pageQuery(EmployeePageQueryDTO employeePageQueryDTO);

    @AutoFill(value = OperationType.UPDATE)
    void update(TeaCup teaCup);

    /**
     * 插入员工数据
     *
     * @param teaCup
     */
    @Insert("insert into teaCup(name,type,price,remaining,create_time,update_time,status,photo)" +
            "values" +
            "(#{name},#{type},#{price},#{remaining},#{createTime},#{updateTime},#{status},#{photo})")
    @AutoFill(value = OperationType.INSERT)
    void insert(TeaCup teaCup);

    @Delete("delete from teaCup where name = #{name}")
    void deleteById(String name);

    List<TeaCup> list(TeaCup teaCup);
}
